//
// Created by Administrator on 2023/8/4.
//


#include <iostream>
#include <vector>
#include <numeric>
#include <valarray>

using namespace std;

class Solution {
public:
    long long findTheArrayConcVal(vector<int> &nums) {
        long long ans = 0;
        for (int i = 0, j = nums.size() - 1; i <= j; i++, j--) {
            if (i == j) {
                ans += nums[i];
            } else {
                ans += concate(nums[i], nums[j]);
            }
        }
        return ans;
    }

    int concate(int x, int y) {
        // 计算出y的位数
        int count = 0;
        int temp = y;
        while (temp) {
            temp = temp / 10;
            count++;
        }
        return x * pow(10, count) + y;
    }
};

int main() {
    Solution solution;
    vector<int> nums = {7, 52, 2, 4};
    cout << solution.findTheArrayConcVal(nums) << endl;
    return 0;

}